
<template>
	<el-dialog :title="title" :visible="dialogISshow" :fullscreen="fullscreen" :width="width" @close="close" center class="v-dialog" :top="top">
		<v-form :form="options" :col="col" @submit="confirm" :reset="!dialogISshow" :labelWidth="labelWidth">
			<slot></slot>
			<el-col :span="24" class="m-dialog-footer" v-if="footerIsShow">
				<el-button @click="close">取 消</el-button>
				<el-button type="primary" native-type="submit">确认</el-button>
			</el-col>
		</v-form>
	</el-dialog>
</template>
<script>
export default {
	name: 'Dialog',
	props: {
		dialogISshow: {
			type: Boolean,
			default: false,
		},
		title: {
			type: String,
			default: '添加菜单',
		},
		options: {
			type: Object,
			default() {
				return {};
			},
		},
		operationType: {
			type: String,
			default: '',
		},
		fullscreen: {
			type: Boolean,
			default: false,
		},
		col: {
			type: Number,
			default: 24,
		},
		width: {
			type: String,
			default: '50%',
		},
		top: {
			type: String,
			default: '15vh',
		},
		footerIsShow: {
			type: Boolean,
			default: true,
		},
		labelWidth: {
			type: String,
			default: '120px',
		},
	},
	data() {
		return {
			// formData: {},
			reset: false,
		};
	},
	created() {
		console.log('rest--------', this.reset);
		this.reset = false;
	},
	methods: {
		close() {
			this.reset = true;
			this.$emit('close');
		},
		confirm(validate, data) {
			console.log(validate, '-------');
			validate
				.then(res => {
					console.log('验证通过');
					this.$emit('confirm', data);
				})
				.catch(err => {
					console.log('验证不通过');
				});
		},
	},
};
</script>
style.<style lang="scss">
.v-dialog {
	.m-dialog-footer {
		display: flex;
		justify-content: center;
	}
	.el-col {
		float: none;
	}
}
</style>


